package io.virtualapp.widgets;

import android.animation.AnimatorSet;
import android.content.Context;
import android.support.annotation.NonNull;
import android.widget.ImageView;
import android.widget.TextView;

import io.virtualapp.R;


/**
 * Created by cheng
 * PackageName APP_Lock
 * 2018/1/23 11:47
 */

public class DialogDownLoadAPK extends BaseDialog {

    private TextView dowload;
    private TextView txt_versionCode;
    private onClickListener onClickListener;
    private String versionCode;
    public DialogDownLoadAPK(@NonNull Context context, String versionCode) {
        super(context);
        this.versionCode=versionCode;
    }

    @Override
    protected float setWidthScale() {
        return 0.9f;
    }

    @Override
    protected AnimatorSet setEnterAnim() {
        return null;
    }

    @Override
    protected AnimatorSet setExitAnim() {
        return null;
    }

    @Override
    protected void init() {
//        cancle = findViewById( R.id.download_cancle);
        dowload = findViewById(R.id.download_setting);
        txt_versionCode=findViewById( R.id.txt_versionCode );
        txt_versionCode.setText( versionCode );
//        cancle.setOnClickListener(v -> {
//            if (onClickListener != null){
//                dismiss();
//
//                onClickListener.onClick(false);
//            }
//        });
        dowload.setOnClickListener(v -> {
            if (onClickListener != null){
                dismiss();
                onClickListener.onClick(true);
            }
        });
    }

    @Override
    protected int getContentViewId() {
        return R.layout.dialog_download;
    }

    public void setOnClickListener(onClickListener listener){
        this.onClickListener = listener;
    }

    public interface onClickListener{
        void onClick(boolean clicked);
    }
}
